
var aa = function(){
    var session = require('koa-generic-session');
    var redisStore = require('koa-redis');
    var koa = require('koa');
    var redis = require('redis');
    // 注意: client默认是异步callback方式调用;
    // store.client是经过了co-redis包装,返回Promise, 在koa里面用yield异步编程比较方便
    var client = redis.createClient(6379, "127.0.0.1");
    
    var app = koa();
    
    app.keys = ['keys', 'keykeys'];
    // var option={host: "172.19.65.240", db:1};
    var options = {
        client: client,
        db: 1
    };
    
    var store = redisStore(options);
    app.use(session({
        store: store
    }));

    return store    
}


module.exports = aa()
